import store from '@/store'
import router from '@/router/index'
// 路由守卫
const routerList = ['/login', '/404']
router.beforeEach((to, from, next) => {
  const token = store.state.user.token
  if (token) {
    next()
  } else {
    if (routerList.includes(to.path)) {
      next()
    } else {
      next('/login')
    }
  }
})
export default router
